{  Statement: http://acmp.ru/?main=task&id_task=387
   Verdict: Accepted
}
uses
    SysUtils, Math;

var
    i,n,ans:longint;
    s:string;
    ch:char;

begin
reset(input,'input.txt');
rewrite(output,'output.txt');
readln(n);
ans := 0;
for i := 1 to n do begin
    readln(s);
    ch := s[1];
    delete(s, 1, 3);
    if s[1] = ch then inc(ans);
end;
write(ans);
end.